package com.jquest.misc;

import org.newdawn.slick.Image;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * Created by IntelliJ IDEA.
 * User: Johan
 * Date: 2009-dec-11
 * Time: 21:43:58
 * To change this template use File | Settings | File Templates.
 */
public class Tileset {

    private HashMap<String, Image> tiles;
    private String name;
    private String fileName;

    public Tileset() {
        tiles = new HashMap<String, Image>();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setFileName(String name) {
        this.fileName = name;
    }

    public String getFileName() {
        return fileName;
    }

    public void add(String name, Image sprite) {
        tiles.put(name, sprite);
    }

    public Image get(String name) {
        return tiles.get(name);
    }

    public Image get(int index) {
        if(index == -1) return null;
        return (Image) tiles.values().toArray()[index];
    }

    public HashMap<String, Image> getTiles() {
        return tiles;
    }

}
